Skip to content

Support TON → Solana sends in ccip-cli #211

Merged
andrevmatos merged 14 commits intomainfrom
fix-ton-to-solana
Apr 22, 2026
Merged

Support TON → Solana sends in ccip-cli #211
andrevmatos merged 14 commits intomainfrom
fix-ton-to-solana

Conversation

@huangzhen1997
Copy link
Copy Markdown
Contributor

@huangzhen1997 huangzhen1997 commented Mar 30, 2026

Adds SVMExtraArgsV1 encoding support for TON source chain, enabling TON → Solana CCIP messages.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ccip-tools-ts Ready Ready Preview, Comment Apr 22, 2026 0:35am

Request Review

@github-actions
Copy link
Copy Markdown

👋 huangzhen1997, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 30, 2026

Coverage Report

ℹ tests 790
ℹ suites 230
ℹ pass 788
ℹ fail 0
ℹ cancelled 0
ℹ skipped 2
ℹ todo 0
ℹ duration_ms 83250.022566

> @chainlink/ccip-cli@1.4.2 test
> node --test

Verbose mode enabled
▶ getCtx
  ▶ output — always stdout
    ✔ output.write goes to stdout (2.128087ms)
    ✔ output.table goes to stdout (1.41048ms)
  ✔ output — always stdout (5.164199ms)
  ▶ logger — always stderr
    ✔ logger.info goes to stderr (0.937207ms)
    ✔ logger.warn goes to stderr (0.549375ms)
    ✔ logger.error goes to stderr (0.700486ms)
  ✔ logger — always stderr (2.509218ms)
  ▶ verbose mode
    ✔ logger.debug is a no-op when verbose is false (0.658187ms)
    ✔ logger.debug goes to stderr when verbose is true (1.999768ms)
  ✔ verbose mode (2.951423ms)
  ▶ destroy signal
    ✔ returns a working destroy function (14.797321ms)
    ✔ calling destroy twice does not throw (0.679968ms)
  ✔ destroy signal (15.689805ms)
✔ getCtx (27.518208ms)
▶ lane-latency command
  ✔ should output JSON format correctly (6.517481ms)
  ✔ should resolve chain IDs to chain selectors (0.793068ms)
  ✔ should use custom API URL when provided (0.721525ms)
  ✔ should output log format correctly (1.030311ms)
  ✔ should handle chain IDs as input (0.732165ms)
  ✔ should handle chain selectors as input (0.731905ms)
  ✔ should throw CCIPApiClientNotAvailableError when --no-api flag is set (1.439464ms)
  ✔ should work normally when --no-api flag is false (0.746462ms)
  ✔ should forward blockConfirmations to API URL (0.733608ms)
  ✔ should not include numOfBlocks when blockConfirmations is not provided (0.63813ms)
  ▶ CCIP_API environment variable integration
    ✔ should respect CCIP_API=false environment variable (0.523326ms)
  ✔ CCIP_API environment variable integration (0.719191ms)
✔ lane-latency command (17.202614ms)
▶ selectRequest non-interactive behavior
  ✔ returns the single request without prompting (1.706903ms)
  ✔ returns the request matching logIndex (0.316781ms)
  ✔ throws CCIPInteractiveRequiredError for multiple requests without logIndex (2.559092ms)
✔ selectRequest non-interactive behavior (6.586971ms)
▶ CCIPInteractiveRequiredError
  ✔ has correct code and is not transient (0.363658ms)
  ✔ uses default recovery when none provided (0.411657ms)
  ✔ preserves context fields (0.239576ms)
✔ CCIPInteractiveRequiredError (1.333777ms)
▶ preprocessArgv TTY auto-detection
  ✔ --interactive flag is defined in globalOpts (1.026163ms)
✔ preprocessArgv TTY auto-detection (1.179099ms)
▶ search messages command
  ✔ should throw CCIPApiClientNotAvailableError when --no-api flag is set (3.441276ms)
  ✔ should output JSON format correctly (24.85445ms)
  ✔ should pass sender filter to API (8.691182ms)
  ✔ should pass receiver filter to API (8.874948ms)
  ✔ should resolve source chain to selector (4.231299ms)
  ✔ should resolve dest chain to selector (2.797185ms)
  ✔ should pass manual-exec-only filter to API (3.843346ms)
  ✔ should treat limit 0 as unlimited (7.721406ms)
  ✔ should respect limit parameter (5.752896ms)
  ✔ should warn when no results found (1.525396ms)
  ✔ should use custom API URL when provided (3.401681ms)
  ✔ should warn on negative limit and fall back to default (2.466569ms)
  ✔ should output log format (1.722212ms)
✔ search messages command (82.259641ms)
▶ e2e command show EVM
  ▶ pretty format (default)
    ✔ should show complete CCIP transaction details EVM to EVM (8642.448831ms)
  ✔ pretty format (default) (8643.540165ms)
  ▶ json format
    ✔ should output a single valid JSON envelope with all expected fields (6695.960081ms)
  ✔ json format (6696.232769ms)
  ▶ log format
    ✔ should output in log format with object assignments (6764.779909ms)
  ✔ log format (6765.078004ms)
  ▶ verbose flag
    ✔ should work with verbose flag enabled (10340.990874ms)
  ✔ verbose flag (10341.207829ms)
  ▶ error handling
    ✔ should handle invalid transaction hash gracefully (6694.093194ms)
    ✔ should require transaction hash argument (1620.174727ms)
  ✔ error handling (8314.603667ms)
  ✔ should show complete CCIP transaction details EVM to Aptos (12690.738943ms)
  ✔ should show complete CCIP transaction details EVM to Solana (7621.585627ms)
✔ e2e command show EVM (61075.358869ms)
▶ e2e command show Solana
  ✔ should show complete CCIP transaction details Solana to EVM (8139.560225ms)
✔ e2e command show Solana (8139.812244ms)
▶ e2e command show Aptos
  ✔ should show complete CCIP transaction details Aptos to EVM (7943.123746ms)
✔ e2e command show Aptos (7943.338628ms)
﹣ e2e command show TON (0.104946ms) # SKIP
▶ formatCCIPError
  ✔ should return null for non-CCIPError instances (1.309261ms)
  ✔ should format CCIPError with code and message (0.469064ms)
  ✔ should include help section with recovery hint (0.152264ms)
  ✔ should include note section for transient errors (0.220371ms)
  ✔ should include retry timing for transient errors with retryAfterMs (0.250117ms)
  ✔ should not include note section for permanent errors (0.251008ms)
  ✔ should format error with structured output (0.311ms)
  ✔ should include stack trace when verbose is true (0.403362ms)
  ✔ should not include stack trace when verbose is false (0.182971ms)
✔ formatCCIPError (5.222307ms)
ℹ tests 59
ℹ suites 21
ℹ pass 59
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 79526.654579
-------------------------------|---------|----------|---------|---------|---------------------------
File                           | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s         
-------------------------------|---------|----------|---------|---------|---------------------------
All files                      |   74.81 |    76.77 |    61.7 |   74.81 |                           
 ccip-cli/src                  |   89.47 |    61.53 |      75 |   89.47 |                           
  index.ts                     |   89.47 |    61.53 |      75 |   89.47 | ...47-151,157-158,163-168 
 ccip-cli/src/commands         |   51.01 |    72.99 |   52.72 |   51.01 |                           
  index.ts                     |     100 |      100 |     100 |     100 |                           
  lane-latency.ts              |   72.56 |     90.9 |   33.33 |   72.56 | 41-56,63-70,105-111       
  manual-exec.ts               |   25.36 |      100 |       0 |   25.36 | 62-116,123-133,135-274    
  parse.ts                     |   57.14 |      100 |       0 |   57.14 | 46-50,57-64,66-91         
  search.ts                    |   81.25 |      100 |       0 |   81.25 | 24-29                     
  send.ts                      |   15.31 |      100 |       0 |   15.31 | ...73-180,190-219,221-457 
  show.ts                      |   77.62 |    61.42 |   66.66 |   77.62 | ...49-257,261-274,305-306 
  supported-tokens.ts          |   17.35 |      100 |       0 |   17.35 | ...11-249,251-325,327-340 
  token.ts                     |   22.72 |      100 |       0 |   22.72 | 24-53,60-67,69-132        
  types.ts                     |     100 |      100 |     100 |     100 |                           
  utils.ts                     |   85.94 |    75.67 |    92.3 |   85.94 | ...99-609,617-625,635-641 
 ccip-cli/src/commands/search  |   49.39 |    83.33 |   14.28 |   49.39 |                           
  messages.ts                  |   49.39 |    83.33 |   14.28 |   49.39 | ...86-188,190-212,214-249 
 ccip-cli/src/providers        |   49.46 |    75.51 |      16 |   49.46 |                           
  aptos.ts                     |   51.47 |      100 |       0 |   51.47 | ...74,82-89,95-96,105-136 
  evm.ts                       |    36.3 |      100 |       0 |    36.3 | 27,47-63,69-104,116-168   
  index.ts                     |   80.16 |    72.72 |      80 |   80.16 | 51-52,193-237             
  solana.ts                    |   47.44 |      100 |       0 |   47.44 | ...,92-98,102-103,112-137 
  sui.ts                       |   64.28 |      100 |       0 |   64.28 | 10-14                     
  ton.ts                       |   15.03 |      100 |       0 |   15.03 | 24-153                    
 ccip-sdk/src                  |   94.49 |    82.38 |    92.5 |   94.49 |                           
  chain.ts                     |   93.25 |    81.33 |   71.42 |   93.25 | ...18,1667-1668,1701-1702 
  commits.ts                   |     100 |    95.23 |     100 |     100 | 52                        
  execution.ts                 |   92.19 |     92.3 |     100 |   92.19 | 130-137,149-156           
  explorer.ts                  |     100 |      100 |     100 |     100 |                           
  extra-args.ts                |     100 |    86.66 |     100 |     100 | 179,214                   
  gas.ts                       |   89.75 |       40 |     100 |   89.75 | 108-119,147-151           
  http-status.ts               |     100 |      100 |     100 |     100 |                           
  index.ts                     |     100 |      100 |     100 |     100 |                           
  messages.ts                  |   88.48 |    45.09 |     100 |   88.48 | ...19-220,229-230,254-255 
  offchain.ts                  |   94.14 |    79.54 |     100 |   94.14 | ...90,208,223-225,234-235 
  requests.ts                  |   90.61 |    82.07 |     100 |   90.61 | ...81-282,350-363,365-369 
  supported-chains.ts          |     100 |      100 |     100 |     100 |                           
  types.ts                     |     100 |      100 |     100 |     100 |                           
  utils.ts                     |   96.36 |    90.36 |     100 |   96.36 | ...67,783,884-885,892-900 
 ccip-sdk/src/api              |   93.75 |       85 |   94.11 |   93.75 |                           
  index.ts                     |   93.75 |       85 |   94.11 |   93.75 | ...39-744,755-758,761-764 
 ccip-sdk/src/aptos            |    55.7 |    69.23 |   55.73 |    55.7 |                           
  exec.ts                      |   29.31 |      100 |       0 |   29.31 | 18-58                     
  hasher.ts                    |   76.31 |       80 |   66.66 |   76.31 | 19-38,52-58               
  index.ts                     |    56.4 |    74.64 |   58.13 |    56.4 | ...26-828,832-858,862-873 
  logs.ts                      |   78.52 |    57.44 |      75 |   78.52 | ...90-196,200-233,264-268 
  send.ts                      |    25.2 |      100 |       0 |    25.2 | 10-51,62-79,92-123        
  token.ts                     |   23.75 |       75 |     100 |   23.75 | 35-156                    
  types.ts                     |   65.62 |      100 |       0 |   65.62 | 25-32,64-88               
 ccip-sdk/src/errors           |   87.41 |    76.16 |   48.38 |   87.41 |                           
  CCIPError.ts                 |     100 |      100 |     100 |     100 |                           
  codes.ts                     |     100 |      100 |     100 |     100 |                           
  index.ts                     |     100 |      100 |     100 |     100 |                           
  recovery.ts                  |     100 |      100 |     100 |     100 |                           
  specialized.ts               |   84.66 |    71.25 |   45.76 |   84.66 | ...27,3348-3357,3378-3387 
  utils.ts                     |   94.44 |    81.48 |     100 |   94.44 | 15,17,22,24               
 ccip-sdk/src/evm              |    83.1 |    74.49 |   89.02 |    83.1 |                           
  const.ts                     |     100 |      100 |     100 |     100 |                           
  errors.ts                    |   84.03 |    78.57 |     100 |   84.03 | ...57-164,170-172,219-237 
  extra-args.ts                |   94.44 |    61.66 |     100 |   94.44 | ...83-184,209-210,326-338 
  fork.test.data.ts            |     100 |      100 |     100 |     100 |                           
  gas.ts                       |   97.97 |    53.33 |     100 |   97.97 | 72-73,75                  
  hasher.ts                    |     100 |     92.3 |     100 |     100 | 134                       
  index.ts                     |    80.4 |     75.3 |   90.16 |    80.4 | ...68,2132-2148,2174-2181 
  logs.ts                      |   34.32 |    68.42 |      25 |   34.32 | ...13-214,229-258,275-302 
  messages.ts                  |     100 |      100 |     100 |     100 |                           
  offchain.ts                  |   81.25 |    33.33 |     100 |   81.25 | 11,13-14                  
  types.ts                     |     100 |      100 |     100 |     100 |                           
 ccip-sdk/src/evm/viem         |   77.72 |       92 |   69.23 |   77.72 |                           
  client-adapter.ts            |     100 |     92.3 |     100 |     100 | 48                        
  index.ts                     |     100 |      100 |     100 |     100 |                           
  wallet-adapter.ts            |   63.09 |     90.9 |   55.55 |   63.09 | ...6,53-73,91-124,131-157 
 ccip-sdk/src/hasher           |   94.29 |    78.94 |     100 |   94.29 |                           
  common.ts                    |     100 |      100 |     100 |     100 |                           
  hasher.ts                    |     100 |    66.66 |     100 |     100 | 19                        
  index.ts                     |     100 |      100 |     100 |     100 |                           
  merklemulti.ts               |   93.43 |       78 |     100 |   93.43 | ...59-260,306-307,315-316 
 ccip-sdk/src/shared           |   88.05 |    69.23 |     100 |   88.05 |                           
  bcs-codecs.ts                |   87.87 |    66.66 |     100 |   87.87 | 75-87,104-106             
  constants.ts                 |     100 |      100 |     100 |     100 |                           
 ccip-sdk/src/solana           |   73.14 |    68.13 |   77.01 |   73.14 |                           
  cleanup.ts                   |   26.63 |    66.66 |   33.33 |   26.63 | 43-53,59-101,113-226      
  exec.ts                      |   69.05 |    62.96 |   66.66 |   69.05 | ...61-463,468-472,512-513 
  fork.test.data.ts            |     100 |      100 |     100 |     100 |                           
  hasher.ts                    |   96.58 |    81.81 |     100 |   96.58 | 67-70                     
  index.ts                     |   76.68 |       75 |   78.84 |   76.68 | ...58,1562-1583,1587-1620 
  logs.ts                      |   74.83 |    38.88 |     100 |   74.83 | 38-39,50-51,53-54,56-88   
  offchain.ts                  |     100 |      100 |     100 |     100 |                           
  patchBorsh.ts                |   78.31 |       50 |     100 |   78.31 | 34-35,41-47,65-66,72-78   
  send.ts                      |   77.55 |    33.33 |      80 |   77.55 | ...45-346,351-359,402-441 
  types.ts                     |     100 |      100 |     100 |     100 |                           
  utils.ts                     |   67.41 |    68.96 |   63.63 |   67.41 | ...36-439,442-444,476-491 
 ccip-sdk/src/sui              |   32.62 |    89.47 |   17.24 |   32.62 |                           
  discovery.ts                 |   14.86 |      100 |       0 |   14.86 | 20-36,49-185,188-222      
  events.ts                    |    19.9 |      100 |       0 |    19.9 | ...18-275,280-397,406-427 
  exec.ts                      |   31.29 |      100 |       0 |   31.29 | 31-74,86-131              
  hasher.ts                    |   98.16 |    66.66 |     100 |   98.16 | 33,49                     
  index.ts                     |   40.44 |    93.18 |   17.94 |   40.44 | ...12-813,817-818,822-823 
  objects.ts                   |   18.93 |      100 |       0 |   18.93 | ...04-119,133-184,195-338 
 ccip-sdk/src/sui/manuallyExec |   39.63 |      100 |       0 |   39.63 |                           
  encoder.ts                   |   47.67 |      100 |       0 |   47.67 | 42-86                     
  index.ts                     |   34.35 |      100 |       0 |   34.35 | 46-131                    
 ccip-sdk/src/ton              |   76.54 |    80.63 |   71.42 |   76.54 |                           
  exec.ts                      |     100 |      100 |     100 |     100 |                           
  extra-args.ts                |   98.66 |    72.72 |     100 |   98.66 | 156-157,222               
  hasher.ts                    |   77.95 |    77.77 |      75 |   77.95 | 99-107,155-186            
  index.ts                     |   70.86 |    76.72 |   55.55 |   70.86 | ...05,1212-1213,1220-1221 
  logs.ts                      |     100 |    98.43 |     100 |     100 | 56                        
  send.ts                      |   95.93 |       70 |     100 |   95.93 | 37-44                     
  types.ts                     |   77.94 |    69.23 |   66.66 |   77.94 | ...-73,91,118-131,133-136 
  utils.ts                     |   63.08 |    78.18 |    90.9 |   63.08 | ...20-326,334-392,394-397 
-------------------------------|---------|----------|---------|---------|---------------------------

Farber98
Farber98 previously approved these changes Mar 31, 2026
Copy link
Copy Markdown
Collaborator

@andrevmatos andrevmatos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some simplifications, but mostly lgtm

Comment thread ccip-sdk/src/ton/send.ts Outdated
Comment thread ccip-sdk/src/ton/send.ts Outdated
Comment thread ccip-sdk/src/ton/send.ts Outdated
Copy link
Copy Markdown
Contributor

@krebernisak krebernisak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I second feedback from Andre, and would be great to add SUI in the same PR

Comment thread ccip-sdk/src/ton/send.ts Outdated
Comment thread ccip-sdk/src/ton/send.ts Outdated
.storeUint(tokenReceiver, 256) // uint256
.storeRef(accountsCell) // SnakedCell<uint256>

return builder.endCell()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please test TONChain.encodeExtraArgs() with these, and decodeExtraArgs its result?
The encode method isn't actively used right now, as we build the cells directly here from the ExtraArgs object when we need to ccipSend below, so we use the Cell result directly, which should be fine.

But in ccip-o11y, we'll need to serialize those to store in ccip-o11y-db, and it'd be good to have a consistent way to serialize them here (we may eventually pull ccip-sdk into ccip-o11y, and then we'll need this). Also, the serialized extraArgs coming from ccip-o11y db through CCIP-API for these will be decoded.

So far for EVM, our idea was to store only the bits content of the cell in serialized form (i.e. NOT the whole serialized cell), so it can begin with the tag, for consistency with all other chain families. But we need to make sure this also works for these snaked cells.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Andre!

I've pushed a commit: eeef3e0

Please review and let's discuss how to resolve this cc @Farber98

So far for EVM, our idea was to store only the bits content of the cell in serialized form (i.e. NOT the whole serialized cell)

This is simple for EVM (small args) but not straightforwards for SVM/SUI extra args which have lists stored as nested cells, and might fail on other future args where more data is required. Cell is a tree structure and has a special BOC encoding b/c of it. This clashes with the idea that chain-specific extraArgs encodings should start with a standard prefix.

Then there's also the current observability implementation which just reads first cell bits, which currently drops data for SVM/SUI (data encoded as more than one root cell): https://github.com/smartcontractkit/ccip-o11y/blob/main/ccip/ton/processor/ton_event_decode.go#L266

Comment thread ccip-sdk/src/ton/send.ts Outdated
Comment thread ccip-sdk/src/ton/send.ts Outdated
andrevmatos
andrevmatos previously approved these changes Apr 20, 2026
Copy link
Copy Markdown
Collaborator

@andrevmatos andrevmatos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits, we can re-approve later

Comment thread ccip-sdk/src/utils.ts Outdated
Comment thread ccip-sdk/src/ton/index.ts Outdated
Copy link
Copy Markdown

@patricios-space patricios-space left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@andrevmatos andrevmatos merged commit 649507b into main Apr 22, 2026
13 checks passed
@andrevmatos andrevmatos deleted the fix-ton-to-solana branch April 22, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants